#encoding:utf-8
from szdb.models import User,News,Activity,NewsType
from django.contrib import admin

# 用户管理类

class UserAdmin(admin.ModelAdmin):
	
	
	list_display=('username','type','email','sex')
	list_filter=['type']
	search_fields=['username']

# 新闻管理类

class NewsAdmin(admin.ModelAdmin):
	
	
	list_display=('title', 'type', 'keyword', 'releasetime')
	list_filter=['type', 'releasetime']
	search_fields=['title']
	date_hierarchy = 'releasetime'

# 活动管理类

class ActivityAdmin(admin.ModelAdmin):


	list_display=('title', 'date', 'releasetime', 'owner', 'place')
	list_filter=['date', 'releasetime']
	search_fields=['title','owner']
	date_hierarchy = 'date'
	

# 注册新闻管理admin
admin.site.register(News, NewsAdmin)
# 注册栏目管理admin
admin.site.register(NewsType)
# 注册用户管理admin
admin.site.register(User, UserAdmin) 
# 注册活动管理admin
admin.site.register(Activity, ActivityAdmin) 

